﻿using Furion;
using GWB.Core.Common;
using GWB.Supplier;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;

namespace GWB.System.Api.Extensions
{
    /// <summary>
    /// 
    /// </summary>
    public static class SqlsugarSetup
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="services"></param>
        public static void AddSqlsugarSetup(this IServiceCollection services)
        {


            //如果多个数数据库传 List<ConnectionConfig>
            var configConnection = new ConnectionConfig()
            {
                DbType = DbType.SqlServer,
                ConnectionString = App.Configuration["DBConnectionStr"],
                IsAutoCloseConnection = true
            };
            var sqlSugar = SqlSugarDb.SqlSugarScope(configConnection);
            services.AddSingleton<ISqlSugarClient>(sqlSugar);//这边是SqlSugarScope用AddSingleton

        }
    }


}